package com.za.apm.cat.action;

import java.util.Random;
import java.util.concurrent.TimeUnit;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 类FirstAction.java的实现描述：
 * 
 * @author: tongyufu 2017-11-22 10:37:39
 */
@RestController
public class FirstAction {

	Logger log = LoggerFactory.getLogger(FirstAction.class);

	@RequestMapping("first")
	public String first() throws Exception {
		int status = Math.abs(new Random().nextInt()) % 3;
		log.info("---info");
		log.debug("---debug");
		log.error("---error");
		if (status == 0) {
			System.out.println(1 / 0);
		}
		if (status == 1) {
			System.out.println("---执行慢---");
			TimeUnit.SECONDS.sleep(3);
		}
		if (status == 2) {
			System.out.println("===正常执行===");
		}
		return "first";
	}

}
